import React from 'react'
import ReactDOM from 'react-dom'

function UserGreet(params) {
  return (
    <h1>欢迎登录</h1>
  )
}
function UserLogin(params) {
  return (
    <h1>用户登录</h1>
  )
}
class Parent extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      isLogin: false
    }
  }
  render() {
    const element = this.isLogin ? <UserGreet /> : <UserLogin />
    console.log(element)
    return (
      <div>
        <h1>小熊</h1>
        <h2>小兔子</h2>
        <h3>小恐龙</h3>
        <h2>这是三元运算符的操作</h2>
        {this.state.isLogin ? <UserGreet /> : <UserLogin />}
      </div>
    )
  }
}

ReactDOM.render(<Parent/>, document.getElementById('root'))

